<?php
session_start();
if (empty($_SESSION['username']) AND empty($_SESSION['passuser'])){
  echo "<link href='style.css' rel='stylesheet' type='text/css'>
 <center>Untuk mengakses modul, Anda harus login <br>";
  echo "<a href=../../index.php><b>LOGIN</b></a></center>";
}
else{
include "../../../config/koneksi.php";

$module=$_GET[module];
$act=$_GET[act];

// Hapus Ongkos Kirim
if ($module=='ongkos' AND $act=='hapus'){
  mysql_query("DELETE FROM wilayah WHERE id_wilayah='$_GET[id]'");
  header('location:../../widoropanel.php?module='.$module);
}

// Input Ongkos Kirim
elseif ($module=='ongkos' AND $act=='input'){
  mysql_query("INSERT INTO wilayah(nama_wilayah,ongkos_kirim) VALUES('$_POST[nama_wilayah]','$_POST[ongkos_kirim]')");
  header('location:../../widoropanel.php?module='.$module);
}

// Update Ongkos Kirim
elseif ($module=='ongkos' AND $act=='update'){
  mysql_query("UPDATE wilayah SET nama_wilayah='$_POST[nama_wilayah]', ongkos_kirim='$_POST[ongkos_kirim]' WHERE id_wilayah = '$_POST[id]'");
  header('location:../../widoropanel.php?module='.$module);
}
}
?>
